package com.example.jwtdemo.config;

import com.example.jwtdemo.intercepts.JwtIntercept;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Woo_home
 * @create 2020/9/14 14:57
 */

@Configuration
public class InterceptConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JwtIntercept())
                // 其它接口 token 验证
                .addPathPatterns("/user/test")
                // 所有用户可访问
                .excludePathPatterns("/user/login");
    }
}
